package com.nand.library.base.adapter.holder;

import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import androidx.annotation.IdRes;
import androidx.recyclerview.widget.RecyclerView;

/**
 * Created by 孝杰 on 2019/12/17.
 */

public class BaseViewHolder extends RecyclerView.ViewHolder {
    private int viewType;
    private View view;

    public BaseViewHolder(View itemView) {
        super(itemView);
        this.view = itemView;
    }

    public BaseViewHolder(View itemView, int viewType) {
        super(itemView);
        this.view = itemView;
        this.viewType = viewType;
    }

    /**
     * 获取 布局类型标示
     */
    public int getViewType() {
        return viewType;
    }

    public View getView(@IdRes int id) {
        return view.findViewById(id);
    }

    public ImageView getImgView(@IdRes int id) {
        return ((ImageView) view.findViewById(id));
    }

    public TextView getTextView(@IdRes int id) {
        return ((TextView) view.findViewById(id));
    }

}
